<template>
	<view class="main">
		<view class="top"></view>
		<view class="content">

			<!-- <view class="item-single item-other">
				<view class="item-name-left">
					<span class="item-name-tip">入库申请单</span>
				</view>
			</view> -->
			<view class="item-single">
				<span class="item-single-name">驳回原因</span>
				<span class="item-single-value">{{dataInfo.rason}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">项目编号</span>
				<span class="item-single-value">{{dataInfo.projectCode}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">项目名称</span>
				<span class="item-single-value">{{dataInfo.projectName}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">供应商编号</span>
				<span class="item-single-value">{{dataInfo.partnerCode}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">供应商名称</span>
				<span class="item-single-value">{{dataInfo.partnerName}}</span>
			</view>
			<view class="item-single item-other">
				<view class="item-name-left">
					<span class="item-name-tip">商品信息</span>
				</view>
			</view>


			<view class="item-single">
				<span class="item-single-name">仓库名称</span>
				<span class="item-single-value">{{dataInfo.warehouseName}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">存货名称</span>
				<span class="item-single-value">{{dataInfo.inventoryName}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">成分</span>
				<span class="item-single-value">{{dataInfo.component}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">来源</span>
				<span class="item-single-value">{{dataInfo.source}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">单价</span>
				<span class="item-single-value">{{dataInfo.price}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">含税单价</span>
				<span class="item-single-value">{{dataInfo.taxPrice}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">税率</span>
				<span class="item-single-value">{{dataInfo.taxRate}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">数量</span>
				<span class="item-single-value">{{dataInfo.quantity}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">单位</span>
				<span class="item-single-value">{{dataInfo.unitName}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">总价</span>
				<span class="item-single-value">{{dataInfo.amount}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">含税总价</span>
				<span class="item-single-value">{{dataInfo.taxAmount}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">备注</span>
				<span class="item-single-value">{{dataInfo.remark}}</span>
			</view>
			
			<view class="item-single item-other">
				<view class="item-name-left">
					<span class="item-name-tip">付款信息</span>
				</view>
			</view>


			<view class="item-single">
				<span class="item-single-name">总货款</span>
				<span class="item-single-value">{{dataInfo.totalPayment}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">已支付金额</span>
				<span class="item-single-value">{{dataInfo.origEarnestMoney}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name item-single-name-other ">银行流水凭证</span>
			</view>
			<view class="item-file-box">
				<uploadFile :fileList1="fileList1" :limit="0" :showDel="false" />
			</view>
			<view class="item-single">
				<span class="item-single-name">未支付金额</span>
				<span class="item-single-value">{{dataInfo.noMoney}}</span>
			</view>
			
			<view class="item-single item-other">
				<view class="item-name-left">
					<span class="item-name-tip">物流信息</span>
				</view>
			</view>

			<view class="item-single">
				<span class="item-single-name">车号</span>
				<span class="item-single-value">{{dataInfo.wagonNumber}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">司机姓名</span>
				<span class="item-single-value">{{dataInfo.driverName}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name item-single-name-other">司机身份证号</span>
				<span class="item-single-value">{{dataInfo.driverCard}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">联系方式</span>
				<span class="item-single-value">{{dataInfo.driverTel}}</span>
			</view>
			<view class="item-single">
				<span class="item-single-name">过磅单</span>
			</view>
			<view class="item-file-box">
				<uploadFile :fileList1="fileList2" :limit="0" :showDel="false" />
			</view>
			<view class="item-single">
				<span class="item-single-name">合同</span>
			</view>
			<view class="item-file-box">
				<uploadFile :fileList1="fileList3" :limit="0" :showDel="false" />
			</view>
			<view class="item-single">
				<span class="item-single-name">发票</span>
			</view>
			<view class="item-file-box">
				<uploadFile :fileList1="fileList4" :limit="0" :showDel="false" />
			</view>
		</view>

		<!--底部按钮-satrt-->
		<view class="btn">
			<view class="btn-item btn-item-left" @click="submit(2)">不通过</view>
			<view class="btn-item btn-item-right" @click="submit(1)">通过</view>
		</view>
		<!--底部按钮-end-->
		<u-overlay :show="showAudit">
			<auditForm @close="closePop" @comPop="comPop"></auditForm>
		</u-overlay>


	</view>
</template>


<script>
	import auditForm from '@/components/auditForm.vue'
	export default {
		components: {
			auditForm
		},

		data() {
			return {
				dataInfo: {},
				postData:{},
				showAudit: false,
				fileList1: [],
				fileList2: [],
				fileList3: [],
				fileList4: [],
			}
		},
		onLoad(options) {
			this.postData.id = options.id
			this.getInfo()
		},

		methods: {
			getInfo() {
				let that = this
				this.$postjson('/api/RqPurchaseOrder/getInfo', {id:this.postData.id*1}).then(res => {
					this.dataInfo = res.data.data
					let tem1 =  this.dataInfo.bankStatementVoucher?this.dataInfo.bankStatementVoucher.split(','):[]
					tem1.forEach(v=>{
					 that.fileList1.push({url: that.baseUrl +v})
					})
					
					let tem2 =  this.dataInfo.weighingSheet?this.dataInfo.weighingSheet.split(','):[]
					tem2.forEach(v=>{
					 that.fileList2.push({url: that.baseUrl +v})
					})
					let tem3 =  this.dataInfo.contract?this.dataInfo.contract.split(','):[]
					tem3.forEach(v=>{
					 that.fileList3.push({url: that.baseUrl +v})
					})
					let tem4 =  this.dataInfo.invoiceImg?this.dataInfo.invoiceImg.split(','):[]
					tem4.forEach(v=>{
					 that.fileList4.push({url: that.baseUrl +v})
					})
					
				})
			},
			submit(state){
				this.postData.state = state
				if(state == 1){
					this.postData.note = ''
					this.examine()
				}else{
					this.showAudit = true
				}
			},
			
			closePop(){
				this.showAudit = false
			},
			comPop(data){
				if(!data.note){
					uni.$u.toast('请填写驳回原因')
					return
				}
				this.postData.rason = data.note
				this.examine()	
			},
			examine(){
				uni.showLoading({
					title: '提交中'
				});
				let that = this
				this.$postjson('/api/RqPurchaseOrder/editSh', this.postData).then( res => {
					if (res.data.code == 200) {
						setTimeout(v => {
							uni.navigateBack()
							that.showAudit = false
						}, 1000)
						uni.$u.toast('操作成功')
					} else {
						this.$modal.msgInfo(res.data.msg)
					}					
				})
			}
		},


	}
</script>

<style lang="scss" scoped>
	.main {
		padding-bottom: 250upx;
	}

	page {
		background: #F9F9F9;
	}

	.top {
		width: 100%;
		height: 154rpx;
		background: linear-gradient(-180deg, #11AA66 0%, #12C66B 100%);
	}

	.content {
		width: calc(100% - 24upx - 60upx);
		margin: -134upx auto 0 auto;
		// height: 820rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 6rpx 34rpx 0rpx rgba(159, 186, 174, 0.1);
		border-radius: 10rpx;
		padding: 40upx 30upx;
		padding-top: 10upx;
	}

	.item-single {
		display: flex;
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #666666;
		margin-top: 30upx;
		align-items: center;
	}

	.item-file-box {
		margin-top: 30upx;
	}

	.item-single-name {
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #666666;
		width: 120rpx;
		display: inline-block;
		margin-right: 12upx;

	}

	.item-single-value {
		display: inline-block;
		width: calc(100% - 120upx - 12upx);
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		font-size: 28rpx;
		color: #111111;
	}

	.item-other {
		margin-top: 0 !important;
		padding-bottom: 10upx;
		// border-bottom: 1rpx solid rgba(228, 228, 228, 0.6);
		padding-top: 40upx;
	}

	.item-single-name-other {
		// font-family: PingFangSC, PingFang SC;
		// font-weight: 500;
		// font-size: 28rpx;
		// color: #111111;
		width: 150upx;
	}
	

	.item-single-value-other {
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #111111;
	}

	.btn {
		position: fixed;
		bottom: 0;
		left: 0;
		height: 118rpx;
		background: #FFFFFF;
		box-shadow: 0rpx -2rpx 0rpx 0rpx rgba(0, 0, 0, 0.06);
		padding-bottom: 68rpx;
		padding-left: 30upx;
		padding-right: 30upx;
		padding-top: 30upx;
		width: calc(100% - 60upx);
		display: flex;
		justify-content: space-between;


		.btn-item {
			font-family: PingFangSC, PingFang SC;
			font-weight: 500;
			font-size: 32rpx;
			color: #FFFFFF;
			text-align: center;
			width: 276rpx;
			height: 88rpx;
			background: linear-gradient(138deg, #12C66B 0%, #11AA66 100%);
			border-radius: 44rpx;
			margin: auto;
			line-height: 88upx;
		}

		.btn-item-left {
			background: #fff !important;
			border: 2rpx solid #11AA66;
			color: #11AA66;
		}
	}

	.item-name-left {
		display: flex;
		align-items: center;
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #111111;
		position: relative;
	}

	.item-name-left::after {
		content: '';
		width: 8rpx;
		height: 28rpx;
		background: linear-gradient(180deg, #11AA66 0%, #12C66B 100%);
		position: absolute;
		left: 0;
		top: 6upx;
	}

	.item-name-tip {
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #111111;
		margin-left: 20upx;
		margin-right: 20upx;
	}
</style>